﻿using System;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[RequireComponent(typeof(Button))]
public class UIBackButton : MonoBehaviour
{
    [CompilerGenerated]
    private static UnityAction <>f__am$cache1;
    [CompilerGenerated]
    private static Func<YieldInstruction> <>f__am$cache2;
    private Button button;

    private void Start()
    {
        this.button = base.GetComponent<Button>();
        if (<>f__am$cache1 == null)
        {
            <>f__am$cache1 = delegate {
                if (NetworkUtility.networkManager != null)
                {
                    NetworkUtility.DestroyNetwork();
                }
                else
                {
                    if (<>f__am$cache2 == null)
                    {
                        <>f__am$cache2 = () => SceneManager.LoadSceneAsync("Title");
                    }
                    ScreenFader.Fade(<>f__am$cache2);
                }
            };
        }
        this.button.onClick.AddListener(<>f__am$cache1);
    }
}

